package demo;

//无法被继承
final class Base{
    static String str1;
    String str;
    static{
        str1 = "Basehahaha";
        Base base = new Base();
        System.out.println("str1 = " + str1 + " str = " + base.str);
    }
    int nofo;
    {
        nofo = 5;
    }

    @Override
    public String toString() {
        return "Base{" +
                "str='" + str + '\'' +
                ", nofo=" + nofo +
                '}';
    }

    Base(){
        System.out.println("Base默认构造函数");
    }
    Base(String str){
        this.str = str;
        System.out.println("Base的构造函数 + str=" + this.str);
    }

    //无法被重写
    final void func(){
        System.out.println("Base的func函数");
    }

}

/*class Derived extends Base{
    Derived(String str){
        super(str);
        System.out.println("Derived构造函数");
    }
    void func(){
        System.out.println("Derived的func函数");
    }
}*/
public class Test {

    public static void main(String[] args) {
        Base base = new Base("stesat");
        System.out.println(base);
    }
    public static void main1(String[] args) {
        /*Base base = new Derived("nonono");
        base.func();*/
        //常量
        final int x = 10;
        //x = 20;
    }
}
